package com.kafka.demo.consumer;

import com.alibaba.fastjson.JSON;
import com.kafka.demo.common.MessageEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author gy
 * @date 2018/11/3 17:54
 */
@Slf4j
@Component
public class SimpleConsumer {

    @KafkaListener(topics = "${kafka.topic.default}", containerFactory = "kafkaListenerContainerFactory")
    public void receive(MessageEntity message) {
        log.info(JSON.toJSONString(message));
    }

}
